<?php
declare(strict_types=1);

namespace App\Library\Api;
use App\Library\Api\AbstractApi;
use Swoft\Log\Helper\Log;

/**
 * Class InnerApi
 * @package App\Library\Api
 */
class InnerApi extends AbstractApi {
    //开发环境
    protected $uri_dev = 'http://inner.api.jnfresh.cn/';

    //测试环境
    protected $uri_test = 'http://inner.api.jnfresh.cn/';

    //生产环境
    protected $uri_prod = 'http://inner.api.freshjn.com/';

    /**
     * @var string
     */
    protected $apiKey = 'jWii5uTjerWYHjjQnWdfgkpSL45';

    public function sendResetPassword($mobile,$pass){
        $text = "【江楠鲜品】您的新密码是{$pass}";
        $type = 'vendor_send_password';
        $params = [
            'mobile' => $mobile,
            'text' => $text,
            'type' => $type,
        ];
        $result = $this->requestPost('sms/send' , $params,  true);
        if(!is_array($result) || $result['code'] != 0){
            Log::error('InnerApi Error. params:'.json_encode($params).';result:'.json_encode($result));
            return false;
        }
        return true;
    }


}